package util;

import burp.IBurpExtenderCallbacks;

import java.io.PrintWriter;

/**
 * Created by td on 2017/6/28.
 */
public class BurpCallbacks {
    private static BurpCallbacks burpCallbacks = null;
    private IBurpExtenderCallbacks callbacks;
    private PrintWriter stdout;

    public BurpCallbacks(IBurpExtenderCallbacks callbacks, PrintWriter stdout) {
        this.callbacks = callbacks;
        this.stdout = stdout;
    }

    public BurpCallbacks() {
    }

    public static BurpCallbacks getInstance(){
        if (burpCallbacks==null){
            burpCallbacks = new BurpCallbacks();
        }
        return burpCallbacks;
    }

    public IBurpExtenderCallbacks getCallbacks() {
        return callbacks;
    }

    public void setCallbacks(IBurpExtenderCallbacks callbacks) {
        this.callbacks = callbacks;
    }

    public PrintWriter getStdout() {
        return stdout;
    }

    public void setStdout(PrintWriter stdout) {
        this.stdout = stdout;
    }

    public void print(String string){
        if (this.stdout!=null) {
            this.stdout.println(string);
        }
    }
}
